<template>
  <div class="numberList">
    <!--彩种列表数据-->
    <div class="numberNav">
      <nav class="navNumLi">
        <li v-for="(firstNavItem,firstNavIndex) in playNavData" :class="{selected:firstNavIndex==currentFirstIndex}"
            @click="selectFirstNav(firstNavItem.code,firstNavIndex)" :key="firstNavIndex">{{firstNavItem.name}}
        </li>
      </nav>
      <div class="navNumWrapper">
        <ul>
          <li class="displayFlex" v-for="(secondNavItem,secondNavIndex) in playSecondNavData">
            <div class="navNumPlay" :class="{'active': secondNavIndex === currentSecondNavIndex}">{{secondNavItem.name}}</div>
            <div class="navNumItem">
              <p :class="{'active': secondNavListIndex === currentSecondIndex}" v-for="(secondNavListItem,secondNavListIndex) in secondNavItem.dataList" @click="selectSecondNav(secondNavListIndex)">{{secondNavListItem.name}}</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <!--彩种号码 列表-->
    <div class="colorPause">
      <div class="cPauseTitle">
        <Tooltip :content='exampleText' :transfer=transferLog placement="top-end">
          <section>
            <p>范例</p>
          </section>
        </Tooltip>
        <Tooltip :content='winningDescriptionText' :transfer='transferLog' placement="top-end">
          <section>
            <p>中奖说明</p>
          </section>
        </Tooltip>
      </div>
      <div class="happyDigital" v-if="displayLottery.happyTrue">
        <!--北京快乐8-->
        <div class="happyNoteNum" v-for="(local,localIndex) in getTheCurrentData.localData || []">
          <ul>
            <li v-for="betData in local.lotteryData" :class="{'active': betData.numTrue}" @click="noteNumberSelection(localIndex, betData, getTheCurrentData.id)">{{betData.name}}</li>
          </ul>
          <div class="happyNoteTrigger" v-if="displayLottery.fullTrue">
            <ul>
              <li v-for="(eventD,eventIndex) in local.eventData" :class="{'active': eventD.numTrue}" @click="eventOpt(localIndex,eventIndex)">{{eventD.name}}</li>
            </ul>
          </div>
        </div>
      </div>
      <!--广东11选5-->
      <div class="cPauseDigital" v-if="displayLottery.proTrue">
        <div class="cPauseRow displayFlex" v-for="(local,localIndex) in getTheCurrentData.localData || []">
          <section class="cName"><p>{{local.lotteryName}}</p></section>
          <section class="cNum">
            <p v-for="betData in local.lotteryData" :class="{'active': betData.numTrue, 'throughTrueCls': displayLottery.throughTrue}" @click="noteNumberSelection(localIndex,betData)">{{betData.name}}</p>
          </section>
          <section class="cBtn">
            <p v-for="(eventD,eventIndex) in local.eventData" :class="{'active': eventD.numTrue}" @click="eventOpt(localIndex,eventIndex)">{{eventD.name}}</p>
          </section>
        </div>
      </div>
      <!--文本域-->
      <div class="cPauseDigital" v-if="displayLottery.literalTrue">
        <div class="cPauseRow displayFlex">
          <section class="cTextarea">
            <textarea @input="betNumInput" v-model="textareaBetNum"></textarea>
            <p class="textareaFooter">每一注号码之间请用一个逗号[,]隔开</p>
          </section>
          <section class="clearInputNum">
            <p @click="delRepeatNum">删除重复号</p>
            <p @click='clearAllNum'>清空</p>
          </section>
        </div>
      </div>
      <!--投注号码 begin-->
      <!--投注号码：-->
      <div class="clearBegin" style="display: none;">{{totalNotesNum}}</div>
      <!--投注号码 end-->
      <div class="cPauseStep">
        <p>
          <span class="cPauseImg">1</span>
          <span class="cPauseText">选择号码</span>
        </p>
      </div>
      <div class="cPauseMidCool displayFlex">
        <div class="cPauseSlider">
          <div class="cPauseSliderVue displayFlex">
            <section class="slider" @click="prevSlider">-</section>
            <section>
              <Slider v-model="value1" :min="smallVal" :max="bigVal" :tip-format="format"></Slider>
            </section>
            <section class="slider" @click="nextSlider">+</section>
            <section class="sliderOdds">
              赔率<span>{{value1*10/20}}/ <span>{{officialRebateVal}}</span></span>
            </section>
          </div>
        </div>
        <div class="cPauseSingle">
          <div class="cPauseBack">
            <section class="prev" @click="prevSection">-</section>
            <section class="cInput relative">
              <input type="text" v-model="nextNum" value="1" maxlength='4' @click="showInputList" @blur="cInputBlur">
              <section class="cInputList" v-show="isShowInputList">
                <p v-for="cInputListItem in cInputListData" @click="selectNum(cInputListItem)">{{cInputListItem}}</p>
              </section>
            </section>
            <section class="next" @click="nextSection">+</section>
          </div>
          <div class="cPauseBei">倍</div>
        </div>
        <div class="cPauseNumType">
          <p>已选<span>{{totalNotesNumber}}</span>注</p>
          <p>共计<span>{{parseInt(totalNotesNumber)*2*parseInt(nextNum)}}</span>元</p>
          <!--<p>最多可盈利<span>0</span>元</p>-->
        </div>
        <div class="cPauseSBtn">
          <p><a href="javascript:void(0)" @click="emptyEvent">清空</a></p>
          <p><a href="javascript:void(0)" @click="selectNumOk">选好了</a></p>
        </div>
      </div>
    </div>
    <!--确认投注-->
    <div class="colorPause">
      <div class="colorCart">
        <div class="colorCartLeft">
          <div class="colorWrpT">
            <div class="colorWrpTop"></div>
          </div>
          <div class="colorWrpVb">
            <ul class="colorWrNavTt displayFlex">
              <li v-for="navName in navSubmitData">{{navName}}</li>
            </ul>
            <div class="colorWrTList scrollBar">
              <article class="colorWrArticle displayFlex"
                       v-for="(confirmBetListItem,confirmBetListIndex) in confirmBetListData">
                <section>
                  <p>{{confirmBetListItem.playedName}}</p>
                  <p :title='confirmBetListItem.actionData' class="one-txt-cut">{{confirmBetListItem.actionData}}</p>
                </section>
                <section>{{confirmBetListItem.odds}} / {{confirmBetListItem.rebate}}%</section>
                <section>{{confirmBetListItem.actionNum}}</section>
                <section>{{confirmBetListItem.mode}}</section>
                <section>{{confirmBetListItem.multiple}}</section>
                <section>{{confirmBetListItem.amount}}元
                </section>
                <section @click="romove(confirmBetListIndex)"><img :src="delImg" alt=""></section>
              </article>
            </div>
          </div>
          <div class="colorWrEmpty">
            <a href="javascript:void(0)" @click="clearBetNum"><p>清空号码</p></a>
          </div>
        </div>
        <div class="colorCartRight">
          <div class="colorCartPosition">
            <div class="colorCartDiv"><a href="javascript:void(0)" @click="confirmBetNum"><p>{{confirmTxt}}</p></a></div>
            <div class="colorCartTZ">
              <p>已选<span>{{totalNumber}}</span>注</p>
              <p>共计<span>{{totalPrice}}</span>元</p>
            </div>
          </div>
        </div>
      </div>
      <div class="cPauseStep">
        <p>
          <span class="cPauseImg">2</span>
          <span class="cPauseText">确认投注</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
  import './navNum.scss';
  import {mapState} from 'vuex';
  import '../../../../../assets/js/public/arrayExt/Array_Ext';
  export default {
    data() {
      return {
        confirmTxt:'确认投注',
        isStopSale:false,//是否停售
        //导航数据
        navListData: [],
        //保存提交数据
        navSubmitData: ['玩法', '赔率/返点', '注数', '模式', '倍数', '单笔金额(元)', ''],
        delImg: require('../../../../../assets/images/theColor/icon/delete.png'),
        exampleText: "范例提示文字",//范例提示文字
        winningDescriptionText: "中奖说明提示文字",//中奖说明提示文字
        transferLog: false,
        isCircle: false,//圆形球号
        isRoundRectangle: false,//圆角矩形球号
        isTextareaInput: false,//文本输入球号
        nextNum: 1,//倍数
        mode: 2,//每注金额
        cInputListData: [5, 10, 20, 50, 100, 200, 500, 1000],//加减器的下拉列表值
        isShowInputList: false,
        value1: 0,
        smallVal: 0,
        bigVal: 16,
        betNum: 0,//单笔总投注数
        oddsMax: 0,//最大返点  ---
        oddsMin: 0,//最小返点  ---
        officialRebate: 0,//最大赔率
        personalRebate: 0,//用户赔率
        currentFirstIndex: 0,//一级导航当前下标   ---
        currentSecondIndex: 0,//二级导航当前下标    ---
        currentSecondNavIndex: 0,//二级导航当前标题下标  ---
        lotteryData: [],//彩种数据
        lotteryCode: '',//彩种id值
        bettingNumData: [],//选号区数据
        playNavData: [],//玩法导航数据
        playSecondNavData: [],//玩法二级导航数据  ---
        selectBettingNumData: [],//选择投注号码数据
        confirmBetListData: [],//确认投注列表数据
        textareaBetNum: '',//文本框输入的投注号
        totalBetNum: 0,//总投注数
        totalBetAmount: 0,//总投注金额
        isBusy: false,
        oldtextareaBetNum: '',
        //修改数据
        getTheCurrentData: '', //获取当前索引数据
        getTheBets: [], //获取当前投注号码
        getLotteryCode: '002', //获取code
        totalNotesNumber: 0, //投注号码总注数
        getPlayGround: '', //玩法组code
        totalNumber: 0, //总注数
        totalPrice: 0, //总价格
        totalNotesNum: '', //投注号码
        //北京快乐8 广东11选5
        displayLottery: {
          happyTrue: false,
          proTrue: false,
          literalTrue: false,
          fullTrue: false,
          throughTrue: false, //江苏快三 => 三同号通选
        },
        officialRebateVal: '', //返点值
        secondPlayList: '',
        currentJsonData: {
          id: '',
          name: ''
        }, //彩种的id和name
        currentDateNumber: '', //当前投注期号
        officialLotteryName: '', //彩种名称
        chains: false, //枷锁
        whetherToSeal: false, //是否封盘
        deactivatedTrue: false,
      }
    },
    computed: {
      ...mapState({
        recordColorData: state => state.mutations.recordColorData,
        bottomPourData: state => state.mutations.bottomPourData,
      })
    },
    activated() {
      this.init();
    },
    deactivated() {
      this.deactivatedTrue = true;
      this.status();
    },
    methods: {
      status() {
        let that = this;
        that.currentFirstIndex = 0;
        that.currentSecondNavIndex = 0;
        that.currentSecondIndex = 0;
        that.lotteryStatus();
      },
      lotteryStatus() {
        let that = this;
        that.totalNotesNumber = 0;
        that.totalNotesNum = '';
        that.value1 = 0;
        that.nextNum = 1;
        // that.getTheBets = [];
      },
      //投注过程状态
      lotteryStatus() {
        let that = this;
        that.value1 = 0;
        that.nextNum = 1;
        that.totalNotesNumber = 0;
        that.officialConstantly();
        that.getTheBetsEvent(that.getTheCurrentData.localData);
      },
      init() {
        let that = this;
        that.deactivatedTrue = false;
        that.displayLottery.happyTrue = false;
        that.displayLottery.proTrue = false;
        that.displayLottery.literalTrue = false;
        that.displayLottery.fullTrue = false;
        that.displayLottery.throughTrue = false;
        /*导航初始化*/
        // that.lotteryStatus();
        that.initData();
      },
      //初始化彩种数据
      initData() {
        let that = this;
        that.lotteryCode = parseInt(that.$route.query.code);
        that.lotteryData = JSON.parse(JSON.stringify(that.recordColorData[that.lotteryCode].data));
        that.isStopSale = that.lotteryData.status=='1'?false:true;
        if (that.lotteryData.length <= 0) return false;
        //获取当前期号和彩种名称
        that.currentDateNumber = that.lotteryData.nowNumber || '';
        that.officialLotteryName = that.lotteryData.name || '';
        that.playNavData = that.lotteryData.groupList || [];
        /*获取玩法组数据*/
        that.playSecondNavData = that.playNavData[that.currentFirstIndex].playList;
        that.getPlayGround = that.playNavData[that.currentFirstIndex].code;
//        that.lotteryData.rebate = 5;
        //设置最大赔率值最小赔率值
        that.officialRebate = that.lotteryData.officialRebate || 8;
        that.personalRebate = that.lotteryData.rebate || 8;
        that.bigVal = that.personalRebate * 2;
        //获取当前数据
        that.getTheCurrentData = that.playNavData[that.currentFirstIndex].playList[that.currentSecondNavIndex].dataList[that.currentSecondIndex];
        //获取当前的playList
        that.secondPlayList = that.playNavData[that.currentFirstIndex].playList[that.currentSecondNavIndex].name;
        //获取当前的id和name
        that.currentJsonData.id = that.getTheCurrentData.id;
        that.currentJsonData.name = that.getTheCurrentData.name;
        //获取当前的介绍
        that.exampleText = that.getTheCurrentData.info || '';
        that.winningDescriptionText = that.getTheCurrentData.simpleInfo || '';
        //获取当前的最大赔率和最小赔率
        that.oddsMax = parseFloat(that.getTheCurrentData.odds) || 0;
        that.oddsMin = parseFloat(that.getTheCurrentData.oddsMin) || 0;
        //初始化二级导航
        // that.selectFirstNav(that.playNavData[0].code, 0);
        if(that.getTheCurrentData.localData) {
          that.getTheBetsEvent(that.getTheCurrentData.localData);
        }
        that.getLotteryCode = that.$route.query.code;
        let getId = parseInt(that.getTheCurrentData.id);
        let code = that.getLotteryCode;
        if(code === '008'||code==='026') {
          that.displayLottery.happyTrue = true;
          if(getId === 622||getId ===3953) {
            that.displayLottery.fullTrue = true;
          }else {
            that.displayLottery.fullTrue = false;
          }
        } else if((code === '002' && getId !== 128 && getId !== 129)||(code === '020')||(code === '022') || code === '006' || (code === '010'|| code==='023' || (code === '004' && (getId !== 317 && getId !== 325 && getId !== 331 && getId !== 337 && getId !== 341 && getId !== 345 && getId !== 349)) || (code === '016' && (getId !== 2491 && getId !== 2493 && getId !== 2487 && getId !== 2483 && getId !== 2479 && getId !== 2473 && getId !== 2467 && getId !== 2459)) || (code === '018' && (getId !== 2539 && getId !== 2541 && getId !== 2527 && getId !== 2521 && getId !== 2515 && getId !== 2507 && getId !== 2531 && getId !== 2535)))) {
          //大小单双
          that.displayLottery.proTrue = true;
        } else if((code === '002' && (getId === 128 || getId === 129)) || code==='020' || code==='022' || (code === '004' && (getId === 317 || getId === 325 || getId === 331 || getId === 337 || getId === 341 || getId === 345 || getId === 349)) || (code === '016' && (getId === 2491 || getId === 2493 || getId === 2487 || getId === 2483 || getId === 2479 || getId === 2473 || getId === 2467 || getId === 2459)) || (code === '018' && (getId === 2539 || getId === 2541 || getId === 2527 || getId === 2521 || getId === 2515 || getId === 2507 || getId === 2531 || getId === 2535))) {
          // 单式
          that.displayLottery.literalTrue = true;
        }
        if(code === '010' && (getId === 1190 || getId === 1191)||code === '023' && (getId === 3623 || getId === 3624)) {
          that.displayLottery.throughTrue = true;
        }
        //throughTrue
        that.officialRebateVal = that.officialRebateEvent(that.oddsMax, that.oddsMin);
      },
      //官方返點計算
      officialRebateEvent(oddsMaxv, oddsMinv) {
        let oddsMax = parseInt(Math.round(oddsMaxv*1000));
        let oddsMin = parseInt(Math.round(oddsMinv*1000));
        let officialRebate = parseInt(Math.round(this.officialRebate*10));
        let personalRebate = parseInt(Math.round(this.personalRebate*10));
        let value = parseInt(Math.round(this.value1 * 10) / 2);
//        let odds = (((oddsMax - oddsMin) / officialRebate * personalRebate + oddsMin - (oddsMax - oddsMin) * value / officialRebate)/1000);
        let one = (personalRebate - value) / officialRebate;
        let odds = ((oddsMax - oddsMin)*one+oddsMin)/1000;
        if (odds.toString() == 'NaN') {
          return 0;
        } else {
          return Math.floor(odds*1000)/1000;
        }
      },
      //初始化数据
      getTheBetsEvent(localArr) {
        //getTheBets
        let that = this;
        let len = localArr.length;
        that.getTheBets = [];
        for(let i = 0; i < len; i++) {
          that.getTheBets.push([]);
        }
      },
      //一级导航选择
      selectFirstNav(code, index) {
        let that = this;
        that.currentFirstIndex = index;
        that.currentSecondNavIndex = 0;
        that.currentSecondIndex = 0;
        that.getPlayGround = code;
        that.init();
        that.lotteryStatus();
      },
      //二级导航选择
      selectSecondNav(index) {
        let that = this;
        that.currentSecondIndex = index;
        that.init();
        that.lotteryStatus();
      },
      //投注号码形状判断
      // betNumShape(id) {
      //   let that = this;
      //   //显示球形投注号(默认)
      //   that.isCircle = true;
      //   that.isRoundRectangle = false;
      //   that.isTextareaInput = false;
      //   //显示圆角矩形投注号
      //   if (id == 130) {
      //     that.isCircle = false;
      //     that.isRoundRectangle = true;
      //     that.isTextareaInput = false;
      //   }
      //   //显示文本域
      //   if (id == 128 || id == 129 || id == 125) {
      //     that.isCircle = false;
      //     that.isRoundRectangle = false;
      //     that.isTextareaInput = true;
      //   }
      // },
      //全大小单双
      eventOpt(index, allIndex) {
        let that = this;
        // that.getTheCurrentData.localData[index].setIndex = parseInt(index);
        //获取数据和触发数据
        let lotteryCurrentData = that.getTheCurrentData.localData[index].lotteryData;
        let eventData = that.getTheCurrentData.localData[index].eventData;
        let len = lotteryCurrentData.length;
        let l = 0;
        that.emptyOpt(lotteryCurrentData, l);
        that.allEmatOpt(eventData, l);
        that.getTheBets[index] = [];
        let eventCurrent = eventData[allIndex];
        eventCurrent.numTrue = 'true';

        if(eventCurrent.name === '全') {
          for(l in lotteryCurrentData) {
            lotteryCurrentData[l].numTrue = true;
            that.retentionDataEvent(index,lotteryCurrentData[l].name);
          }
        }
        if(eventCurrent.name === '大') {
          l = Math.ceil(len / 2);
          let k = len % 2 === 0 ? 0 : 1;
          for (let i = l-k; i < len; i++) {
            lotteryCurrentData[i].numTrue = true;
            that.retentionDataEvent(index,lotteryCurrentData[i].name);
          }
        }
        if(eventCurrent.name === '小') {
          l = Math.floor(len / 2);
          for (let i = 0; i < l; i++) {
            lotteryCurrentData[i].numTrue = true;
            that.retentionDataEvent(index,lotteryCurrentData[i].name);
          }
        }
        if(eventCurrent.name === '单') {
          lotteryCurrentData.forEach((v, i) => {
            if (parseInt(v.name) % 2 !== 0) {
              v.numTrue = 'true';
              that.retentionDataEvent(index,v.name);
            }
          })
        }
        if(eventCurrent.name === '双') {
          lotteryCurrentData.forEach((v, i) => {
            if (parseInt(v.name) % 2 === 0) {
              v.numTrue = 'true';
              that.retentionDataEvent(index,v.name);
            }
          })
        }
        if(eventCurrent.name === '清') {
          that.retentionDataEvent(index, '-1');
        }
      },
      noteNumberSelection(index, numData ,id) {
        numData.numTrue = !numData.numTrue ? true : false;
        this.notNumSelectEvent(index, numData.name, numData.numTrue, id, numData);
      },
      //单个号码处理
      notNumSelectEvent(index, name, status, id, numData) {
        let that = this;
        if(status) {
          that.getTheBets[index].push(name);
          id = parseInt(id);
          if(id === 623 || id === 624 || id === 625 || id === 626 || id === 627 || id === 628) {
            let len = that.getTheBets[index].length;
            if(len > 8) {
              that._Util.conditionSet(len, 8);
              that.getTheBets[index].splice(len-1,1);
              numData.numTrue = false;
            }
          }
        }else {
          that.getTheBets[index].forEach((v,i)=>{
            if(v === name) {
              that.getTheBets[index].splice(i,1);
            }
          })
        }
        that.calcStakeCountCallback();
      },
      //初始化选中数据
      emptyOpt(numArr, l) {
        for (l in numArr) {
          numArr[l].numTrue = false;
        }
      },
      //初始化大小单双的状态
      allEmatOpt(numArr, l){
        for (l in numArr) {
          numArr[l].numTrue = false;
        }
      },
      //当前玩法初始化
      officialConstantly() {
        let that = this;
        that.getTheCurrentData.localData.forEach((v,i)=>{
          v.lotteryData.forEach((l,y)=>{
            l.numTrue = false;
          })
          v.eventData.forEach((e,k)=>{
            e.numTrue = false;
          })
        })
      },
      //数据保留处理
      retentionDataEvent(index,name) {
        //getTheBets
        let that = this;
        if(name === '-1') {
          that.getTheBets[index] = [];
        }else if(name) {
          that.getTheBets[index].push(name);
        }
        that.calcStakeCountCallback();
      },
      calcStakeCountCallback() {
        //北京快乐8
        let that = this;
        that.getLotteryCode = that.$route.query.code;
        let id = parseInt(that.getTheCurrentData.id);
        let len = that.getTheBets.length;
        if(that.getLotteryCode === '008') {
          let lotteryLen = that.getTheBets[0].length;
          that.totalNotesNum = '';
          if(id === 622) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 1);
          }
          if(id === 623) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 2);
          }
          if(id === 624) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 3);
          }
          if(id === 625) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 4);
          }
          if(id === 626) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 5);
          }
          if(id === 627) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 6);
          }
          if(id === 628) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 7);
          }
        }
        if(that.getLotteryCode === '026') {
          let lotteryLen = that.getTheBets[0].length;
          that.totalNotesNum = '';
          if(id === 3953) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 1);
          }
          if(id === 3954) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 2);
          }
          if(id === 3955) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 3);
          }
          if(id === 3956) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 4);
          }
          if(id === 3957) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 5);
          }
          if(id === 3958) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 6);
          }
          if(id === 3959) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNumberCal(lotteryLen, 7);
          }
        }
        //广东11选5
        if(that.getLotteryCode === '002'||that.getLotteryCode === '020'||that.getLotteryCode === '022') {
          that.totalNotesNum = '';
          if(id === 125||id===3607||id===3461) {
            that.totalNumberEvent();
          }
          if(id === 130||id === 3612||id === 3466) {
            that.totalNumberSop();
          }
          if(id === 126||id === 3608||id === 3462) {
            that.totalNumberTwo();
          }
          if(id === 131||id === 3613||id === 3467) {
            // that.totalNotesNum = '';
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 1);
          }
          if(id === 127||id === 3609||id === 3463) {
            that.totalNumberThree();
          }
          if(id === 132||id === 3614||id === 3468) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 1);
          }
          if(id === 133||id === 3615||id === 3469) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 2);
          }
          if(id === 192||id === 3616||id === 3470) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 3);
          }
          if(id === 193||id === 3617||id === 3471) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 4);
          }
          if(id === 194||id === 3618||id === 3472) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 5);
          }
          if(id === 195||id === 3619||id === 3473) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 6);
          }
          if(id === 196||id === 3620||id === 3474) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 7);
          }
          if (id === 197||id === 3621||id === 3475) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 8);
          }
        }
        //北京pk10
        if(that.getLotteryCode === '006') {
          that.totalNotesNum = '';
          if(id === 522) {
            that.totalNumberEvent();
          }
          if(id === 523) {
            that.totalNumberTwo();
          }
          if(id === 525) {
            that.totalNumberThree();
          }
          if(id === 528) {
            that.totalNumberSop();
          }
        }
        //江苏快三
        if(that.getLotteryCode === '010') {
          that.totalNotesNum = '';
          if(id === 1189 || id === 1190 || id === 1191 || id === 1193) {
            that.totalNumberEvent();
          }
          if(id === 1192) {
            let len = that.getTheBets[0].length;
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = (len * (len - 1) * (len - 2)) / (3 * 2);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if (id === 1194) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            let officialArr = [];
            that.getTheBets[0].forEach((v) => {
              officialArr.push(v.substr(0, 1));
            });
            let totalNewArr = Array.intersect(that.getTheBets[1], officialArr);
            let totalNewArrLen = totalNewArr.length;
            that.totalNotesNumber = officialArr.length * that.getTheBets[1].length - totalNewArrLen;
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if (id === 1195) {
            let len = that.getTheBets[0].length;
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = (len * (len - 1)) / 2
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
        }
        //上海快三
        if(that.getLotteryCode === '023') {
          that.totalNotesNum = '';
          if(id === 3622 || id === 3623 || id === 3624  || id === 3626) {
            that.totalNumberEvent();
          }
          if(id === 3625) {
            let len = that.getTheBets[0].length;
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = (len * (len - 1) * (len - 2)) / (3 * 2);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if (id === 3627) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            let officialArr = [];
            that.getTheBets[0].forEach((v) => {
              officialArr.push(v.substr(0, 1));
            });
            let totalNewArr = Array.intersect(that.getTheBets[1], officialArr);
            let totalNewArrLen = totalNewArr.length;
            that.totalNotesNumber = officialArr.length * that.getTheBets[1].length - totalNewArrLen;
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if (id === 3628) {
            let len = that.getTheBets[0].length;
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = (len * (len - 1)) / 2
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
        }
        //重庆时时彩  QQ分分彩  腾讯分分彩
        if(that.getLotteryCode === '004' || that.getLotteryCode === '016' || that.getLotteryCode === '018') {
          that.totalNotesNum = '';
          if(id === 312 || id === 313 || id === 2456 || id === 2457 || id === 2504) {
            that.totalNumberSop();
          }
          if(id === 316 || id === 2458) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = that._Util.calculationsRide(that.getTheBets, 5);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          //五星单式
          if(id === 317 || id === 2459 || id === 2507) {

          }
          if(id === 318 || id === 2460 || id === 2508) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 5);
          }
          if(id === 319 || id === 2461 || id === 2509) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 60, 2);
          }
          if(id === 320 || id === 2462 || id === 2510) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 30, 2);
          }
          if(id === 321 || id === 2463 || id === 2511) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 20, 2);
          }
          if(id === 322 || id === 2464 || id === 2512) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 10, 2);
          }
          if(id === 323 || id === 2465 || id === 2513) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 10, 2);
          }
          //前四玩法
          if(id === 324 || id === 330 || id === 2466 || id === 2472 || id === 2514 || id === 2520) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = that._Util.calculationsRide(that.getTheBets, 4);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          //前四单式
          if(id === 325 || id === 2467 || id === 2515 || id === 2521) {

          }
          if(id === 326 || id === 2468 || id === 2516) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 4);
          }
          if(id === 327 || id === 2469 || id === 2517) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 12, 2);
          }
          if(id === 328 || id === 2470 || id === 2518) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 2);
          }
          if(id === 329 || id === 2471 || id === 2519) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 10, 2);
          }
          //后四玩法
          if (id === 332 || id === 2474 || id === 2522) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 4);
          }
          if (id === 333 || id === 2475 || id === 2523) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 12, 2);
          }
          if (id === 334 || id === 2476 || id === 2524) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 2);
          }
          if (id === 335 || id === 2477 || id === 2525) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.groupStartFive(that.getTheBets, 10, 2);
          }
          //前三码
          if(id === 336 || id === 340 || id === 344 || id === 2478 || id === 2482 || id === 2486 || id === 2526 || id === 2530 || id === 2534) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = that._Util.calculationsRide(that.getTheBets, 3);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if(id === 338 || id === 342 || id === 346 || id === 2480 || id === 2484 || id === 2488 || id === 2528 || id === 2532 || id === 2536) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNotesNumber = len * (len - 1);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          if(id === 339 || id === 343 || id === 347 || id === 2481 || id === 2485 || id === 2489 || id === 2529 || id === 2533 || id === 2537) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 3);
          }
          //二星直选
          if(id === 348 || id === 350 || id === 2490 || id === 2492 || id === 2538 || id === 2540) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = that._Util.calculationsRide(that.getTheBets, 2);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          //不定胆
          if(id === 352 || id === 353 || id === 2494 || id === 2495 || id === 2542 || id === 2543) {
            that.totalNumberSop();
          }
          if(id === 354 || id === 355 || id === 2496 || id === 2497 || id === 2544 || id === 2545) {
            let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            len = that.getTheBets[0].length;
            that.totalNumberCal(len, 2);
          }
          //大小单双
          if(id === 356 || id === 357 || id === 2498 || id === 2499 || id === 2546 || id === 2547) {
            let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
            that.totalNotesNum = informationNumber.number;
            that.totalNotesNumber = that._Util.calculationsRide(that.getTheBets, 2);
            that.totalNotesMarry = that.totalNotesNumber * 2;
          }
          //趣味型
          if(id === 358 || id === 359 || id === 360 || id === 361 || id === 2500 || id === 2501 || id === 2502 || id === 2503 || id === 2548 || id === 2549 || id === 2550 || id === 2551) {
            that.totalNumberEvent();
          }
        }
      },
      totalNumberEvent() {
        let that = this;
        that.totalNotesNum = '';
        let len = that.getTheBets[0].length;
        let informationNumber = that._Util.takeLaws(that.getTheBets, that.totalNotesNum);
        that.totalNotesNum = informationNumber.number;
        that.totalNotesNumber = len;
        that.totalNotesMarry = that.totalNotesNumber * 2;
      },
      totalNumberSop() {
        let that = this;
        that.totalNotesNum = '';
        let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
        that.totalNotesNum = informationNumber.number;
        that.totalNotesNumber = that._Util.calculationsNum(that.getTheBets);
        that.totalNotesMarry = that.totalNotesNumber * 2;
      },
      totalNumberTwo() {
        let that = this;
        that.totalNotesNum = '';
        let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
        that.totalNotesNum = informationNumber.number;
        let totalNewArr = Array.intersect(that.getTheBets[1], that.getTheBets[0]);
        let totalNewArrLen = totalNewArr.length;
        that.totalNotesNumber = that.getTheBets[0].length * that.getTheBets[1].length - totalNewArrLen;
        that.totalNotesMarry = that.totalNotesNumber * 2;
      },
      totalNumberThree() {
        let that = this;
        that.totalNotesNum = '';
        let informationNumber = that._Util.takeLawsTwo(that.getTheBets, that.totalNotesNum);
        that.totalNotesNum = informationNumber.number;
        that.totalNotesNumber = that._Util.topThree(that.getTheBets);
        that.totalNotesMarry = that.totalNotesNumber * 2;
      },
      //重庆时时彩-官方
      groupStartFive(arr, id, i) {
        /*
        * 0 => 组选60
        * */
        if (i === 2) {
          let totalArrONE = arr[0].length;
          let totalArrTWO = arr[1].length;
          let total = '';
          let totalArrD = Array.intersect(arr[0], arr[1]);
          let totalArrC = totalArrD.length;
          let totalArrJ = '';
          switch (id) {
            case 60:
              total = totalArrONE * ((totalArrTWO) * (totalArrTWO - 1) * (totalArrTWO - 2) / (3 * 2));
              //获取重号总注数
              totalArrJ = totalArrC * ((totalArrTWO) * (totalArrTWO - 1) * (totalArrTWO - 2) / (3 * 2)) - totalArrC * ((totalArrTWO - 1) * (totalArrTWO - 2) * (totalArrTWO - 3) / (3 * 2));
              this.totalNotesNumber = total - totalArrJ;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
            case 30:
              total = totalArrTWO * ((totalArrONE) * (totalArrONE - 1) / (2));
              //获取重号总注数
              totalArrJ = totalArrC * ((totalArrONE) * (totalArrONE - 1) / (2)) - totalArrC * ((totalArrONE - 1) * (totalArrONE - 2) / (2));
              this.totalNotesNumber = total - totalArrJ;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
            case 20:
              total = totalArrONE * ((totalArrTWO) * (totalArrTWO - 1) / (2));
              //获取重号总注数
              totalArrJ = totalArrC * ((totalArrTWO) * (totalArrTWO - 1) / (2)) - totalArrC * ((totalArrTWO - 1) * (totalArrTWO - 2) / (2));
              this.totalNotesNumber = total - totalArrJ;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
            case 10:
              total = totalArrONE * totalArrTWO - totalArrC;
              total = total < 0 ? 0 : total;
              this.totalNotesNumber = total;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
            //前四玩法
            case 12:
              total = totalArrONE * ((totalArrTWO) * (totalArrTWO - 1) / (2));
              //获取重号总注数
              totalArrJ = totalArrC * ((totalArrTWO) * (totalArrTWO - 1) / (2)) - totalArrC * ((totalArrTWO - 1) * (totalArrTWO - 2) / (2));
              this.totalNotesNumber = total - totalArrJ;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
            case 4:
              let total = totalArrONE * ((totalArrTWO - 1));
              total = total < 0 ? 0 : total
              this.totalNotesNumber = total;
              // this.totalNotesMarry = this.totalNotesNumber * 2;
              break;
          }
        }

      },
      //北京快乐8
      totalNumberCal(len, id) {
        let that = this;
        switch (id) {
          case 1:
            that.totalNotesNumber = len;
            break;
          case 2:
            that.totalNotesNumber = (len * (len - 1)) / 2;
            break;
          case 3:
            that.totalNotesNumber = (len * (len - 1) * (len - 2)) / (3 * 2);
            break;
          case 4:
            that.totalNotesNumber = (len * (len - 1) * (len - 2) * (len - 3)) / (4 * 3 * 2);
            break;
          case 5:
            that.totalNotesNumber = (len * (len - 1) * (len - 2) * (len - 3) * (len - 4)) / (5 * 4 * 3 * 2);
            break;
          case 6:
            that.totalNotesNumber = (len * (len - 1) * (len - 2) * (len - 3) * (len - 4) * (len - 5)) / (6 * 5 * 4 * 3 * 2);
            break;
          case 7:
            that.totalNotesNumber = (len * (len - 1) * (len - 2) * (len - 3) * (len - 4) * (len - 5) * (len - 6)) / (7 * 6 * 5 * 4 * 3 * 2);
            break;
          case 8:
            that.totalNotesNumber = (len * (len - 1) * (len - 2) * (len - 3) * (len - 4) * (len - 5) * (len - 6) * (len - 7)) / (8 * 7 * 6 * 5 * 4 * 3 * 2);
            break;
        }
      },
      //号码选择完成
      selectNumOk() {
        let that = this;
        if(that.whetherToSeal) {
          that._Util.showAlert('已封盘');
          return;
        }
        if(that.totalNotesNumber <= 0) {
          that._Util.showAlert('请选择投注号码');
          return;
        }
        let selectBettingNumData = {
          playedGroupCode: that.getPlayGround,
          playedGroupName: that.secondPlayList,    //玩法组名称
          playedId: that.currentJsonData.id,                     //玩法id
          playedName: that.currentJsonData.name,                   //玩法名称
          actionNum: that.totalNotesNumber,                                  //单个玩法注数
          actionData: that.totalNotesNum,                         //投注注数
          rebate: parseInt(that.value1)/2,                           //返点
          rebateAmount: 0,
          amount: parseInt(that.totalNotesNumber)*2*parseInt(that.nextNum),
          odds: that.officialRebateVal,                               //赔率
          mode: 1,                                       //模式   1.官方   2信用
          multiple: parseInt(that.nextNum)                                    //金额
        };
        that.confirmBetListData.push(selectBettingNumData);
        that.lotteryStatus();
      },
      //清空
      emptyEvent(){
        this.lotteryStatus();
      },
      //确认投注
      confirmBetNum() {
        let that = this;
        if(that.isStopSale){
          that._Util.showAlert('暂停销售');
          return;
        }
        if(that.whetherToSeal) {
          that._Util.showAlert('已封盘');
          return;
        }
        if(that.confirmBetListData.length <= 0){
          that._Util.showAlert('亲，你还没有投注哦...');
          return;
        }
        let athectData = {
          lotteryCode: that.$route.query.code,
          lotteryName: that.officialLotteryName,
          actionNo: that.currentDateNumber,
          totalNum: that.totalNumber,            //投注总注数
          totalAmount: that.totalPrice,
          itemStr: JSON.stringify(that.confirmBetListData)
        };
        if(that.chains) return;
        that.chains = true;
        that._Util.post(that, that._Api.POST_CONFIRM_BTEEING_DATA, athectData, (data, oldData)=> {
          that.chains = false;
          if(parseInt(oldData.code) === -1) {
            that._Util.showAlert(oldData.msg);
          }else {
            that._Util.showAlert('投注成功');
            setTimeout(function() {
              that.lotteryEmptyDataEvent();
              that.$parent.$refs.theColorFooter.initData();
            },2000);
          }
        },(data)=> {
          if(parseInt(data.code) === 97) {
//            that.$router.push({name: 'topUp', query: {id: 4}});
          }
          that.chains = false;
        },'post');
      },
      //投注成功清空数据
      lotteryEmptyDataEvent() {
        this.confirmBetListData = [];
      },
      //计算总投注数和总投注金额
      getAllNumAndAmount() {
        let that = this;
        that.totalNumber = 0;
        that.totalPrice = 0;
        if(that.confirmBetListData.length <= 0) return;
        that.confirmBetListData.forEach((v,i)=> {
          that.totalNumber += parseInt(v.actionNum);
          that.totalPrice += parseFloat(v.amount);
        });
      },
      //单式-文本框-投注号码-输入
      betNumInput() {

      },
      //单式-文本框-投注号码-清除重复号
      delRepeatNum() {
        let that = this;
        let betNumArr = [];
        if (this.textareaBetNum == '') {
          that._Util.showAlert('请输入投注号码');
          return false;
        }
        if (this.textareaBetNum.indexOf(',') > -1) {
          betNumArr = this.textareaBetNum.split(",");
          this.textareaBetNum = that._Util.deWeight(betNumArr).result.join(',');
        }

        if (that._Util.deWeight(betNumArr).repeatNum.length > 0) {
          that._Util.showMessage(that, {content: ["已为您删除重复号码:  " + that._Util.deWeight(that._Util.deWeight(betNumArr).repeatNum).result.join(',')]});
        } else {
          that._Util.showMessage(that, {content: ['亲，没有重复的号码哦，^o^!']});
        }
      },
      //单式-文本框-过滤无效重复号码
      isRightNum() {
        let that = this;
        let textareaBetNumArr = [];
        if (this.textareaBetNum == '') {
          that._Util.showAlert('请输入投注号码');
          return false;
        } else {
          if (this.textareaBetNum.indexOf(',') > -1) {
            textareaBetNumArr = this.textareaBetNum.split(",");
          } else {
            textareaBetNumArr.push(this.textareaBetNum);
          }
        }
        let arr = that._Util.deWeight(textareaBetNumArr).result || [];//去重后的号码数组
        let delRepeatNumber = that._Util.deWeight(textareaBetNumArr).repeatNum || [];//重复号码
        let delWrongNum = [];//无效号码
        let content = [];//messageBox数据
        //号码检测规则
        let testRuleArr = [];
        testRuleArr = that.isExceedDigits(arr, 2);
        if (testRuleArr.length > 0) {
          delWrongNum.push(testRuleArr);
        }
        //messageBox显示
        if (delWrongNum.length > 0 || delRepeatNumber.length > 0) {
          if (delWrongNum.length > 0) {
            content.push("已为您过滤无效号码： " + delWrongNum.join(","));
          }
          if (delRepeatNumber.length > 0 && that._Util.deWeight(delRepeatNumber).result.join(",") != '') {
            content.push("已为您删除重复号码： " + that._Util.deWeight(delRepeatNumber).result.join(","));
          }
          that._Util.showMessage(that, {content});
        }

        //过滤后最终的结果
        this.textareaBetNum = arr.join(',');
        that.bettingInfo.actionData = this.textareaBetNum;
      },
      //单式-文本框-投注号码-超位检测+空号检测
      isExceedDigits(arr, num) {
        let result = [];
        for (let i = 0; i < arr.length; i++) {
          if (arr[i].length > num || arr[i] == '') {
            let delArr = arr.splice(i, 1);
            result.push(delArr);
            i--;
          }
        }
        return result;
      },
      //单式-文本框-投注号码-清除所有输入号
      clearAllNum() {
        this.textareaBetNum = ''
      },
      //初始化选号区数据
      initBetNumData() {
        this.value1 = 0;
        this.betNum = 0;
        this.nextNum = 1;
        //单式-文本框-投注号码-清除所有输入号
        this.clearAllNum();
      },
      //确认投注-删除单条投注数据
      romove(index) {
        let that = this;
        that.confirmBetListData.splice(index, 1);
      },
      //确认投注-清除号码
      clearBetNum() {
        this.confirmBetListData = [];
      },
      //倍数加
      nextSection() {
        this.nextNum = this.nextNum * 1;
        this.nextNum += 1;
        if (this.nextNum >= 9999) {
          this.nextNum = 9999;
        }
      },
      //倍数减
      prevSection() {
        this.nextNum = this.nextNum * 1;
        if (this.nextNum === 1) return;
        this.nextNum -= 1;
      },
      selectNum(num) {
        this.nextNum = num;
        this.isShowInputList = false;
      },
      //显示倍数下拉列表
      showInputList() {
        this.isShowInputList = !this.isShowInputList;
      },
      //倍数失去焦点
      cInputBlur() {
        setTimeout(() => {
          this.isShowInputList = false;
        },200);
        if (this.nextNum == '' || this.nextNum <= 1) {
          this.nextNum = 1;
        }
      },
      format(val) {},
      //赔率减
      prevSlider() {
        if (this.value1 <= 0) return;
        this.value1 = parseInt(this.value1) - 1;
      },
      //赔率加
      nextSlider() {
        if (this.value1 >= this.bigVal) return;
        this.value1 = parseInt(this.value1) + 1;
      }
    },
    watch: {
      'recordColorData': {
        handler: function () {
          if(this.deactivatedTrue) return;
          this.init();
        },
        deep: true
      },
      'confirmBetListData'() {
        this.getAllNumAndAmount();
      },
      'textareaBetNum'(val) {
        this.textareaBetNum = val.replace(/[^0-9,]/g, '');
      },
      'nextNum'(val) {
        if (val.length == 1) {
          this.nextNum = val.replace(/[^0-9]/g, '');
        }
      },
      '$route.query.code'() {
        if(this.$route.name === 'official') {
          this.status();
          this.lotteryEmptyDataEvent();
        }
      },
      'value1'() {
        let that = this;
        that.officialRebateVal = that.officialRebateEvent(that.oddsMax, that.oddsMin);
      },
      'bottomPourData'() {
        if(this.bottomPourData) {
          this.whetherToSeal = true;
        }else {
          this.whetherToSeal = false;
          //empty
          this.lotteryStatus();
          this.lotteryEmptyDataEvent();
        }
      },
      'isStopSale'(val){
        if(val){
          this.confirmTxt = '暂停销售';
        }else{
          if(this.whetherToSeal){
            this.confirmTxt = '已封盘';
          }else{
            this.confirmTxt = '确定投注';
          }
        }
      },
      'whetherToSeal'(val){
        if(val){
          this.confirmTxt = '已封盘';
        }else{
          this.confirmTxt = '确定投注';
        }
      }
    }
  }
</script>
